import cv2 as cv
import numpy as np

img = cv.imread('../resources/miku.jpg')
cv.namedWindow('image', cv.WINDOW_AUTOSIZE)

cv.createTrackbar('lightness', 'image', 0, 100, lambda x: None)
cv.createTrackbar('contrast', 'image', 0, 100, lambda x: None)

blank = np.zeros_like(img)

while True:
    lightness = cv.getTrackbarPos('lightness', 'image')
    contrast = cv.getTrackbarPos('contrast', 'image') / 100

    blank[:,:] = (lightness, lightness, lightness)

    cv.imshow('image', cv.multiply(cv.add(img, blank), contrast))
    if cv.waitKey(1) == ord('q'):
        break